<include file="__THEME__/public_header"/>
<link href="__APP__/friend.css" type="text/css" rel="stylesheet">
<include file="_nav"/>

<volist name="user" id="v">
    <div>
    {$v.uname}
    <a  onclick="addfriend('{$v.uid}')" style="cursor: pointer" >请求加为好友</a>
    </div>

</volist>



<include file="__THEME__/public_footer"/>

        <script>
            function addfriend(fid){
                $.post(U("friend/Index/friend_apply"), {fid:fid}, function (data) {
                    if(data.data == 1){
                        ui.error('不能添加自己！')
                    }
                    if(data.status == 1){
                        ui.success('消息已经发出！')
                    }
                    else{
                        ui.error('重复添加');
                    }
                  }, 'json');
            }
            function acceptfriend(){
                $.post(U("friend/Index/friend_accept"), {fid: 1}, function (data) {
                    if(data.status == 1){
                        ui.success('消息已经发出！')
                    }
                }, 'json');
            }
        </script>